[AST] Improve ErrorType handling in TypeBase::getMemberSubstitutions()#272
[AST] Improve ErrorType handling in TypeBase::getMemberSubstitutions()#272DougGregor merged 1 commit intoswiftlang:masterfrom
Conversation
|
This LGTM, but I think @DougGregor should also take a look when he gets a chance. Great work, thank you! -Chris |
|
Indeed it solves some issues, but the problem actually caused by this line: The best way to fix those crashes, imho, would be to use safer API for casting: otherwise some other non- |
|
@AlexDenisov thanks for the input. I would assume the Really makes me wish this were all written in Swift, so we could use optional chaining and |
|
Updated with new fixed crashers. |
lib/AST/Type.cpp
Outdated
There was a problem hiding this comment.
I'd rather that the ErrorType check happen a little later, e.g., turn the "castAs()" into a "getAs()" within an "if". Then, we only check the ErrorType condition if all else fails, and can null out baseTy before breaking out of the loop.
15b222c to
bdaf1de
Compare
|
@DougGregor: Updated. (Note that some tests are failing for other reasons; I fixed them in #296.) I have general questions about the error-handling mechanisms throughout; I sent an email to |
|
@DougGregor please let me know if there's anything else to be done here! |
Historical note: a similar change was made in 0033bda.
There was a problem hiding this comment.
The getAs will either produce a NominalType or null; there's no need to check for ErrorType here.
[AST] Improve ErrorType handling in TypeBase::getMemberSubstitutions()
Revert "Also xfail NonEmpty on swift-4.2-branch"
Historical note: a similar change was made in 0033bda.
Fixes 78 compiler_crashers. ⛵